<?php

namespace App\Http\Requests\Admin;

class LoginRequest extends FormRequest
{
    
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'phone' => [
                'required',
                'regex:/^((13[0-9])|(16[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199)\d{8}$/'
            ],
            'password' => [
                'required'
            ]
        ];
    }

    public function messages()
    {
        return [
            'phone.required' => '请输入帐号',
            'phone.regex' => '帐号不正确',
            'password.required' => '密码不能为空',
        ];
    }
}
